
import kit.Kit;
import model.Info;
import service.Build;
import service.impl.BuildCountry;
import service.impl.BuildTown;
import java.util.List;


/**
 * Created by Administrator on 2017/10/17.
 */
public class Application {
    public static void main(String [] args) throws Exception{
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/11/1101.html","北京市",new BuildTown(),"countytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/12/1201.html","天津市",new BuildTown(),"countytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/31/3101.html","上海市",new BuildTown(),"countytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/50/5001.html","重庆市",new BuildTown(),"countytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/50/5002.html","重庆市-1",new BuildTown(),"countytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/13.html","河北省",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/13/1390.html","河北省-1",new BuildTown(),"countytr");
        // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/14.html","山西省",new BuildCountry(),"citytr");
        // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/21.html","辽宁省",new BuildCountry(),"citytr");
       // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/22.html","吉林省",new BuildCountry(),"citytr");
       // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/23.html","黑龙江省",new BuildCountry(),"citytr");
       //  read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/32.html","江苏省",new BuildCountry(),"citytr");
        // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/33.html","浙江省",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/34.html","安徽省",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/35.html","福建省",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/36.html","江西省",new BuildCountry(),"citytr");
        // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/37.html","山东省",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/41.html","河南省",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/41/4190.html","河南省-1",new BuildTown(),"countytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/42.html","湖北省",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/42/4290.html","湖北省-1",new BuildTown(),"countytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/43.html","湖南省",new BuildCountry(),"citytr");
        // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/44.html","广东省",new BuildCountry(),"citytr");
        // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/46.html","海南省",new BuildCountry(),"citytr");
        // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/46/4690.html","海南省-1",new BuildTown(),"countytr");
        // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/51.html","四川省",new BuildCountry(),"citytr");
        // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/52.html","贵州省",new BuildCountry(),"citytr");
        // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/53.html","云南省",new BuildCountry(),"citytr");
        // read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/54.html","西藏自治区",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/61.html","陕西省",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/62.html","甘肃省",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/63.html","青海省",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/15.html","内蒙古自治区",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/64.html","宁夏回族自治区",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/45.html","广西壮族自治区",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/65.html","新疆维吾尔自治区",new BuildCountry(),"citytr");
        //read("http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/65/6590.html","新疆维吾尔自治区-1",new BuildTown(),"countytr");

        System.out.println("OK");
    }


    private static void read(String url,String fileName,Build build,String type) throws Exception{
        System.out.println("read:"+fileName);
        int index = url.lastIndexOf("/");
        String base = url.substring(0,index+1);
        String path = url.substring(index+1);
        List<Info> result = Kit.build(type,base,path,build,1);
        Kit.toFile(fileName,result);
        Thread.sleep(1000);
    }
}
